<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  

  
  <title>Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Hexo">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:locale" content="en">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo">
  
    <link rel="alternate" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-github-hexo博客实战" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/08/12/github-hexo博客实战/" class="article-date">
  <time datetime="2019-08-12T04:31:41.000Z" itemprop="datePublished">2019-08-12</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2019/08/12/github-hexo博客实战/">github+hexo博客实战</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="1-快速开始"><a href="#1-快速开始" class="headerlink" title="1. 快速开始"></a>1. 快速开始</h3><h4 id="1-1创建github上的仓库"><a href="#1-1创建github上的仓库" class="headerlink" title="1.1创建github上的仓库"></a>1.1创建github上的仓库</h4><p>github.com</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> xxxx</span><br></pre></td></tr></table></figure>

<h4 id="1-2-Hexo的安装"><a href="#1-2-Hexo的安装" class="headerlink" title="1.2 Hexo的安装"></a>1.2 Hexo的安装</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#</span></span><br><span class="line">$ npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<h4 id="1-3-Hexo的初始化"><a href="#1-3-Hexo的初始化" class="headerlink" title="1.3 Hexo的初始化"></a>1.3 Hexo的初始化</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> xxx</span><br><span class="line">hexo init ./</span><br><span class="line">npm install</span><br><span class="line">hexo generate</span><br></pre></td></tr></table></figure>

<p><strong>几个常用的git命令</strong></p>
<ol>
<li>hexo g（generate）  生成静态文件</li>
<li>hexo new “博客文章”   新建博客文章</li>
<li>hexo new page “ Page”  新建一个页面</li>
<li>hexo s（server） 启动本地的web服务器</li>
<li>hexo deploy(hexo d) 部署博客到远端</li>
</ol>
<p><strong>命令行输入<a>heep://localhost:4000</a> 看到自己的新建的博客</strong></p>
<h4 id="1-4-更改主题"><a href="#1-4-更改主题" class="headerlink" title="1.4  更改主题"></a>1.4  更改主题</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">ll</span><br><span class="line"><span class="built_in">cd</span> themes  <span class="comment"># themes 是存放主题的地方</span></span><br><span class="line">git <span class="built_in">clone</span> xxx   <span class="comment"># 克隆主题</span></span><br></pre></td></tr></table></figure>

<p>修改配置文件$your_blog_path/_config.yml）</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">theme: BlueLake</span><br></pre></td></tr></table></figure>

<p>完成配置后 重新打开   <a href>localhost:40000</a> 可以看到一个新的主题</p>
<h4 id="1-5-hexo部署到github上"><a href="#1-5-hexo部署到github上" class="headerlink" title="1.5 hexo部署到github上"></a>1.5 hexo部署到github上</h4><p>配置$your_blog_path/_config.yml文件的Deployment：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Deployment</span></span><br><span class="line"><span class="comment">## Docs: https://hexo.io/docs/deployment.html</span></span><br><span class="line">deploy:</span><br><span class="line">  <span class="built_in">type</span>: git</span><br><span class="line">  repo: https://github.com/your_githubName/your_githubName.github.io.git</span><br></pre></td></tr></table></figure>

<p>通过下面的命令进行博客静态页面的生成</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#删除静态文件 </span></span><br><span class="line">$ hexo clean</span><br><span class="line"><span class="comment"># 生成静态文件</span></span><br><span class="line">$ hexo gengerate</span><br><span class="line"><span class="comment"># 部署到远程站点</span></span><br><span class="line">$ hexo  deploy</span><br><span class="line"><span class="comment"># 使用组合命令</span></span><br><span class="line">$ hexo deploy -g</span><br></pre></td></tr></table></figure>


      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2019/08/12/github-hexo博客实战/" data-id="cjz7yeyii00005onp6u6xgz7w" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">August 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2019/08/12/github-hexo博客实战/">github+hexo博客实战</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2019 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>